package com.three.order.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.three.core.entity.ProductOrder;
import com.three.core.vo.R;
import com.three.order.service.OrderService;
import com.three.order.vo.SearchFormVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author ：
 * @date ：Created in 2025/3/11 15:33
 * @description：
 * @modified By：
 * @version:
 */
@RequestMapping("/order")
@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;
    @PostMapping("/OrderManagement")
    public R<IPage<ProductOrder>> orderManagement(@RequestBody SearchFormVo searchFormVo){
        return orderService.selectProductOrderByCondition(searchFormVo);
    }

    @PostMapping("/orderMobile")
    public R<IPage<ProductOrder>> orderMobile(@RequestBody SearchFormVo searchFormVo){
        return orderService.selectMobileProductOrderByCondition(searchFormVo);
    }

    @PostMapping("/updateBuyStatus")
    public R updateBuyStatus(@RequestParam Integer id){
        return orderService.updateBuyStatus(id);
    }

    @GetMapping("/selectOneOrder")
    public R<ProductOrder> selectOneOrder(@RequestParam Integer id){
        return orderService.selectOneOrder(id);
    }
    @DeleteMapping("/delete")
    public R delete(@RequestParam Integer id){
        return orderService.deleteoOrderById(id);
    }
    @GetMapping("/updateReviewStatus")
    public R updateReviewStatus(@RequestParam Integer id){
        return orderService.updateReviewStatus(id);
    }
    @PostMapping("/updateStatus")
    public R updateStatus(@RequestParam Integer id){
        return orderService.updateStatus(id);
    }

    @PostMapping("/updateDeliveryStatus")
    public R updateDeliveryStatus(@RequestParam Integer id){
        return orderService.updateDeliveryStatus(id);
    }
}
